<template>
   <view class="goods-list">
	   <checkbox-group @change="checkboxChange">
    <view class="goods-item" style="padding-left: 15rpx;">
      <view class="item-left flex_center">
        <checkbox @change='change' :value="index" :checked="info.checked" style="transform: scale(.7);"/>
      </view>
      <view class="flex_v_venter" style="flex: 1;padding: 0 20rpx 0 0;">
      	<view class="item-middle">
      			  <image style="width: 100%;height: 100%;" :src="info.thumbnail" mode=""></image>
      	</view>
      	<view class="item-right" style="flex: 1;">
      	  <text class="item-title">{{info.name}}</text>
      	  <text class="item-money">
      	    <text class="money">￥{{info.price}}</text>
      	    <!-- <text class="point">1500积分</text> -->
      	  </text>
      	  <text class="item-volume">
      	    <text>{{info.standardName}}</text>
      	  </text>
      	  <view class="item-numberBox">
      	    <view class="ss flex_v_venter">
      	    	<text @click="jian">-</text>
      	    	<text>{{info.count}}</text>
      	    	<text @click="jia">+</text>
      	    </view>
      	  </view>
      	</view>
      	<view class="item-dele" style="align-self: flex-start;" @click="$emit('delete',{id:info.id,index:index})">
      	  <uni-icons class="dele" type="trash"></uni-icons>
      	</view>
      </view>
    </view>
	</checkbox-group>
  </view>

  <!-- 购物车为空的时候显示的值 -->


  <!-- 提示框 -->
 <!-- <view class="tips">
   <view class="tips-dele">
     <text>提示</text>
      <text>是否从购物车中删除</text>
      <text>
        <text>取消</text>
        <text>确定</text>
      </text>
    </view>
  </view> -->
</template>

<script>
export default {
  name: 'my-goods',
  data() {
    return {
		num:1
	};
  },
  props:{
	  info:{
		  type:Object,
		  default:() => {}
	  },
	  index:Number
  },
  methods:{
	  jian(){
		if(this.info.count == 1){
			return
		}
		this.$emit('jianNum',{id:this.info.id,index:this.index})
	  },
	  jia(){
	  	this.$emit('jiaNum',{id:this.info.id,index:this.index})
	  },
	  checkboxChange(e){
		  this.$emit('submitCheck',{type:e.detail.value.length ? true : false,index:this.index})
	  }
  }
};
</script>

<style lang="scss">
.ss{
		border: 1px solid #EDEDED;
		padding: 5rpx 0;
		border-radius: 10rpx;
		width: 225rpx;
		&>text{
			&{
				padding: 0 17rpx;
			}
			&:nth-child(2){
				padding: 0 55rpx;
				font-size: 25rpx;
			}
			&:first-child{
				border-right: 1px solid #EDEDED;
			}
			&:last-child{
				border-left: 1px solid #EDEDED;
			}
		}
	}
.goods-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  .goods-item {
    width: 691rpx;
	padding: 30rpx 0;
    background-color: #ffffff;
    margin-top: 25rpx;
    border-radius: 12rpx;
    display: flex;
    position: relative;
    .item-left {
      width: 63rpx;
      .chooseBtn {
        margin-top: 114rpx;
        margin-left: 28rpx;
        transform: scale(0.7);
        color: #dcc68d;
      }
    }
    .item-middle {
      width: 164rpx;
      height: 199rpx;
      background-color: #aeaeae;
    }
    .item-right {
      display: flex;
      flex-direction: column;
      margin-left: 47rpx;
      .item-title {
        color: #333;
        font-size: 26rpx;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .item-money {
        font-size: 26rpx;
        margin-top: 26rpx;
        margin-bottom: 21rpx;
        .money {
          color: #333;
        }
        .point {
          color: #e0bc60;
        }
      }
      .item-volume {
        color: #999999;
        font-size: 24rpx;
        display: flex;
        height: 26rpx;
        align-items: center;
        text {
          margin-left: 8rpx;
        }
      }
      .item-numberBox {
        margin-top: 28rpx;
      }
    }
    .item-dele {
    }
  }
}

.cart-empty {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  image {
    width: 160rpx;
    height: 160rpx;
  }
  .empty {
    color: #666666;
    font-size: 22rpx;
    margin-top: 40rpx;
  }
  .empty-btn {
    width: 280rpx;
    height: 70rpx;
    background: #202029;
    border-radius: 35rpx;
    margin-top: 73rpx;
    text-align: center;
    line-height: 70rpx;
    color: #ffffff;
    font-size: 24rpx;
  }
}

.tips {
  background: #000000;
  opacity: 0.8;
  .tips-dele{
    width: 527rpx;
    height: 323rpx;
    background-color: #fff;
    border: 1rpx solid #000000;
    border-radius: 27rpx;
    margin-left: 108rpx;
    display: flex;
    flex-direction: column;
  }
}
</style>
